Launch arguments
-
Launch option to replace languages selected in the system.
Allows to replace order of preferred languages which will be used by the application do display localized content.
Argument:
AppleLanguages
Example:
SystemLanguages([.English, .Polish]) // or [.English, .Polish] as SystemLanguages
Generated strings:
See more-AppleLanguages ("en", "pl")
Declaration
Swift
public struct SystemLanguages : LanguageLaunchArgument, LaunchArgumentWithMultipleValues
-
Launch option to replace locale selected in the system.
Allows to replace users locale.
Argument:
AppleLocale
Example:
SystemLocale(localeIdentifier: "pl") SystemLocale(language: .Polish, country: .Poland)
Generated strings:
See more-AppleLocale "pl" -AppleLocale "pl_PL"
Declaration
Swift
public struct SystemLocale : LocaleLaunchArgument, LaunchArgumentWithSingleValue
-
Launch option to replace software keyboards selected in the system.
Argument:
AppleKeyboards
Example:
SoftwareKeyboards([.Bengali])
Generated strings:
See more-AppleKeyboards ("bn@sw=Bengali")
Declaration
Swift
public struct SoftwareKeyboards : KeyboardLaunchArgument, LaunchArgumentWithMultipleValues
-
Launch option to replace hardware keyboards selected in the system.
Argument:
AppleKeyboards
Example:
HardwareKeyboards([.Bengali])
Generated strings:
See more-AppleKeyboards ("bn@hw=Bangla")
Declaration
Swift
public struct HardwareKeyboards : KeyboardLaunchArgument, LaunchArgumentWithMultipleValues
-
Launch option to replace system keyboards selected in the system.
Argument:
AppleKeyboards
Example:
SystemKeyboards(software: [.Bengali], hardware: [.Bengali])
Generated strings:
See more-AppleKeyboards ("bn@sw=Bengali", "bn@hw=Bangla")
Declaration
Swift
public struct SystemKeyboards : KeyboardLaunchArgument
-
Launch option to enable debug options for CoreData.
sqlDebug
: Enables SQLDebug logging with given verbosity level.syntaxColoredLogging
: Turns on SQL syntax coloring.migrationDebug
: Logs exceptions during data migrations.concurrencyDebug
: Enables extra assertions related to concurrency.sqLiteDebugSynchronous
: Controls behaviour of SQLite disk syncing.sqLiteIntegrityCheck
: Enables extra integrity checking.threadingDebug
: Enables assertions for Core Data’s multi-threading policy.
Example:
See moreCoreDataOption.sqlDebug(verbosityLevel: .high)
Declaration
Swift
public enum CoreDataOption
-
Launch option to enable debug settings for string localization.
doubleLocalizedStrings
: Makes all localized strings twice as long.showNonLocalizedStrings
: Capitalizes all untranslated strings in the application.
Example:
See moreLocalizedStrings.doubleLocalizedStrings
Declaration
Swift
public enum LocalizedStrings : String
-
Any type that implements this protocol can be used to configure application with TestLauncher. Specifically it represents launch argument option so it requires to provide argument
key
. Type conforming to this protocol should override default implementation oflaunchArguments
.Custom launch arguments can implement one of two additional protocols:
For more info about launch arguments variables check: Xcode Help.
See moreDeclaration
Swift
public protocol LaunchArgument : LaunchOption
-
Protocol that should be implemented by types representing launch argument that accepts single argument value.
Example:
enum Server: String, LaunchArgumentWithSingleValue, LaunchArgumentValue { case testing, production var key: String { return "Server" } }
Usage:
let app = XCUIApplication() TestLauncher(options: [ Server.testing ]).configure(app).launch()
Handling:
See morelet serverAddress = UserDefaults.standard.string(forKey: "Server")
Declaration
Swift
public protocol LaunchArgumentWithSingleValue : LaunchArgument
-
Protocol that should be implemented by types representing launch argument that accepts collection of values.
Example:
struct MagicNumbers: LaunchArgumentWithMultipleValues { struct Number: LaunchArgumentValue { var value: String { return "\(number)" } let number: Int } let key = "MagicNumbers" let values: [Number] public init(_ values: [Number]) { self.values = values } }
Usage:
let app = XCUIApplication() TestLauncher(options: [ MagicNumbers([.init(number: 5), .init(number: 7)]) ]).configure(app).launch()
Handling:
See morelet magicNumbers = UserDefaults.standard.stringArray(forKey: "MagicNumbers")
Declaration
Swift
public protocol LaunchArgumentWithMultipleValues : LaunchArgument, ExpressibleByArrayLiteral
-
Represents single portion of data to be passed through launch argument.
Objects implementing
LaunchArgumentValue
are used by theLaunchArgumentWithSingleValue
andLaunchArgumentWithMultipleValues
.AutoMate
provides default implementation forRawRepresentable
objects andBool
values (checkBooleanLaunchArgumentValue
).Example:
enum Server: String, LaunchArgumentWithSingleValue, LaunchArgumentValue { case testing, production var key: String { return "Server" } }
See morestruct Number: LaunchArgumentValue { var value: String { return "\(number)" } let number: Int }
Declaration
Swift
public protocol LaunchArgumentValue